<template>
	<view class="page-container wrap-con">
		<view style="line-height: 30rpx" class="">1.测评工具：知觉压力测评量表（PSS）</view>
		<view class="">2.测评时间：{{ form.appraisalFinishDate }}</view>
		<view class="">
			3.PSS简介：知觉压力量表（Perceived Stress Scale, PSS）由美国社会心理学家 Sheldon Cohen
			于1983年编制，是目前心理学领域评估个体主观压力感受的经典工具。该量表突破了传统压力测评仅关注客观事件的局限，聚焦于个体对压力的主观认知和心理体验，广泛应用于心理健康研究、压力管理干预及流行病学调查等领域。
		</view>
		<view>4.测评数据结果：</view>
		<view>总体得分结果：{{ form.appraisalScore }}</view>
		<view>各因子得分结果：</view>
		<view class="textIndetStyle" v-for="(item, index) in form.userAppraisalDivisorList" :key="index">
			<text>{{ item.divisorName }}</text>
			：
			<text>{{ item.divisorScore }}</text>
		</view>
		<view class="textIndetStyle">5.结果解读及干预建议：</view>
		<view class="textIndetStyle">总体结果解读：</view>
		<view class="textIndetStyle" v-html="proposalSuggest[0]"></view>
		<view class="textIndetStyle">各因子结果解读：</view>
		<view class="textIndetStyle" v-for="(item, index) in appraisalDivisorList" :key="index">
			<view v-html="item.typeFormDatas[0]"></view>
		</view>
		<view>总体干预建议：</view>
		<view v-html="proposalSuggest[1]"></view>
		<view>各因子干预建议：</view>
		<view v-for="(item, index) in appraisalDivisorList" :key="index">
			<view class="textIndetStyle" v-html="item.typeFormDatas[1]"></view>
		</view>
		<view class="say">声明：</view>
		<view class="textIndetStyle">
			以上调查结论及建议只是基于您的问卷调查结果，可能会因未能收集您的更多信息导致报告结果与您的实际状态不完全相符，请根据您的具体情况加以取舍。
		</view>
	</view>
</template>

<script>
import { getUserAppraisal } from '@/api/evaluate/index.js';
import upload from '@/utils/upload';
export default {
	data() {
		return {
			form: {},
			proposalSuggest: [],
			appraisalDivisorList: []
		};
	},
	props: ['resultObj'],
	methods: {
		getSplitParts(rawContent) {
			const delimiter = '------------';
			return rawContent.split(new RegExp(delimiter.replace(/([.*+?^=!:${}()|$$$$\/\\])/g, '\\$1'), 'g'));
		},
		getDetail(id) {
			getUserAppraisal(id).then((res) => {
				this.form = res.data;
				this.appraisalDivisorList = JSON.parse(JSON.stringify(this.form.userAppraisalDivisorList));
				this.appraisalDivisorList.forEach((item) => {
					if (item.proposalSuggest) {
						item.typeFormDatas = this.getSplitParts(item.proposalSuggest);
					} else {
						item.typeFormDatas = ['', ''];
					}
				});

				this.proposalSuggest = this.form.proposalSuggest ? this.getSplitParts(this.form.proposalSuggest) : ['', ''];
			});
		}
	}
};
</script>

<style>
.page-container {
	background-color: #ffffff;
	min-height: 100vh;
	height: auto;
	width: 100%;
}
</style>
